package wellness.activities;

import wellness.activities.beans.LoadBeans;
import wellness.activities.beans.MensageBean;
import wellness.activities.data.UsuarioData;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;

public class Options extends Activity {
	
	Context context;
	CheckBox pro_atividade;
	CheckBox pro_atrativa;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.options);
		
		context = this;	
		pro_atividade = ((CheckBox) findViewById(R.id.CheckBoxAtividade));
        pro_atrativa = ((CheckBox) findViewById(R.id.checkBoxAtrativa));
        
        pro_atividade.setChecked(LoadBeans.getUsuario().isPro_atividades());
        pro_atrativa.setChecked(LoadBeans.getUsuario().isPro_atrativa());
                	
		ImageView goBack = (ImageView) findViewById(R.id.imageViewGoBack);
		goBack.setOnClickListener(new View.OnClickListener() {
            
        	public void onClick(View view) {
        		Intent intent = new Intent();
        		setResult(RESULT_OK, intent);
                finish();
            }
        });
        
		ImageView goHome = (ImageView) findViewById(R.id.imageViewGoHome);
        goHome.setOnClickListener(new View.OnClickListener() {
            
        	public void onClick(View view) {
        		Intent intent = new Intent(Options.this, Main.class);
        		startActivity(intent);
            }
        });
        
        ImageView salvar = (ImageView) findViewById(R.id.imageViewSave);
        salvar.setOnClickListener(new View.OnClickListener() {
            
        	public void onClick(View view) {
        		UsuarioData data = new UsuarioData(context);
        		data.atualizarProatividade(pro_atividade.isChecked(), pro_atrativa.isChecked());
        		LoadBeans.getUsuario().setPro_atividades(pro_atividade.isChecked());
        		LoadBeans.getUsuario().setPro_atrativa(pro_atrativa.isChecked());
        		
        		Intent intent = new Intent(Options.this, Main.class);
        		startActivity(intent);
            }
        });
        
		
	}
}
